<!--
  @author songweidong
  @date 2020-08-01 16:14:28
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<html th:replace="~{work/modify/common/layout :: layout('新机配件信息', ~{::title}, ~{::content}, ~{::script})}">
<head>
    <title>工单管理-新机配件信息</title>
</head>

<body>

<div th:fragment="content">
    <style>
        .layui-table-cell {
            overflow: visible !important;
            height: 34px;
            line-height: 34px;
        }
        .layui-table-box {
            overflow: visible !important;
        }
        .layui-table-body {
            overflow: visible !important;
        }
        .layui-table-box td[data-edit=text] .layui-table-cell{
            border: 0px !important;
        }
        .layui-form-select{
            margin-top: -5px;
        }
        .layui-form-select .layui-select-title .layui-input{
            border: 0px !important;
        }
    </style>

    <form class="layui-form">

        <input id="work-id" type="hidden" name="workId" th:value="${workId}"/>
        <input id="order-id" type="hidden" name="orderId" th:value="${orderId}"/>
        <input id="factory-id" type="hidden" name="factoryId" th:value="${factoryId}">

        <div >
            <div>
                <b>新机：</b>
                <table class="layui-table" id="newMachineTable" lay-filter="newMachineTable"></table>
                <script type="text/html" id="delNewMachineMenu">
                    <input id="expressId" type="hidden" data-value="{{d.expressId}}" name="expressId">
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                </script>
            </div>

            <th:block th:if="${factoryId}">
            <div class="layui-form-item">
                <b>厂商配件-新件记录：</b>
                    <table class="layui-table" id="newPartTable" lay-filter="newPartTable"></table>
                <script type="text/html" id="delNewPartMenu">
                    <input id="postId" type="hidden" data-value="{{d.postId}}" name="postId">
                    <input id="fcOrderPartId" type="hidden" data-value="{{d.fcOrderPartId}}" name="fcOrderPartId">
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                </script>
            </div>

            <div style="margin-top: 10px">
                <b>厂商配件-返厂旧件记录：</b>
                <table class="layui-table" id="usedPart" lay-filter="usedPart-table"></table>
            </div>
            </th:block>

            <div>
                操作备注:
                <textarea id='operatorRemark' style="resize: none;" class="layui-textarea" name="operatorRemark"></textarea>
            </div>
        </div>

        <script type="text/html" id="btn-add">
            <a class="layui-btn layui-btn-xs" lay-event="add">增加</a>
        </script>

        <script type="text/html" id="expressCompanySelect">
            <select tag="expressCompanyList" lay-filter="expressCompanyList" lay-search data-value="{{d.expressCompanyCode}}">
                <option value="">请选择</option>
                <option th:each="item : ${expressCompanyList}" th:value="${item.key}" th:text="${item.value}"></option>
            </select>
        </script>

        <script type="text/html" id="expressCompanySelect2">
            <select tag="expressCompanyList2" lay-filter="expressCompanyList2" lay-search data-value="{{d.expressCompanyCode}}">
                <option value="">请选择</option>
                <option th:each="item : ${expressCompanyList}" th:value="${item.key}" th:text="${item.value}"></option>
            </select>
        </script>

        <script type="text/html" id="postAddressSelect">
            <select name="postAddressType" tag="postAddressList" lay-filter="postAddressList" data-value="{{d.postAddressType}}">
                <option value="">请选择</option>
                <option th:each="item : ${postAddressList}" th:value="${item.key}" th:text="${item.value}"></option>
            </select>
        </script>

        <script type="text/html" id="factoryParts">
            {{#  if(d.fcOrderPartId != null){ }}
                {{ d.partFullName + '/' + d.unit }}
            {{#  } else { }}
                <select class="factoryPart" tag="factoryPartId" name="factoryPartId" lay-filter="factoryPartId" lay-ignore
                        data-option-value="{{d.partId || ''}}" data-option-name="{{d.partFullName || ''}}" style="width: 100%;">
                    <option value="">请选择</option>
                </select>
            {{#  } }}
        </script>

        <div class="layui-form-item" style="text-align: center;margin-top: 30px;">
                <button class="layui-btn" lay-submit>保存</button>
        </div>

    </form>

</div>

<script th:inline="javascript">

    var newMachineList = [[${orderPostList}]];

    var newPartList = [[${newPartVOList}]];

    var usedPartList = [[${usedPartVOList}]];

    var layuiModel = {
        oms_work_modify_newmachinepart: "work/modify/zmn.oms.work.modify.newmachinepart"
    };

</script>
</body>
</html>